{layout name="public/layout" /}
{include file='yxnavbar'}


<script src="{$_G['URL']['LOTTERY_CSS']}lottery/js/screen.js"></script>
<script src="{$_G['URL']['LOTTERY_CSS']}lottery/js/layer/layer.js"></script>
{include file='../../plugin/shopplan/template/web/shopplan_common_nav'}
{if $system['is_shop_plan']==1}
<style type="text/css">
.dataTime { text-align:center; padding:0 .4rem; line-height:40px;  color:#131313;}
.dataList ul{padding: 0 360px}
.dataList li { position:relative; float:left; width:60px;line-height: 30px}
.dataList li span { border-radius:50%; margin:0 auto; color:#d7d6d5; display:block;}
.dataTime span { font-weight:bold; }
.dataList li.cur span { color:#131313;}
.dataList li.cur.cured span{ box-shadow:0 3px 10px rgba(26,119,133,.5); color:#ffffff; background:#147382;}
.dataList li i { zoom:0.8; position:absolute; white-space:nowrap; text-align:center; color:#fb6300; left:0; bottom:-.15rem;}

</style>
<form id="form3"  action="{php echo createWebUrlPlugin('shopplan.editplan',array('themeid'=>$themeid));}" enctype ="multipart/form-data" method="post">
<div class="panel panel-default" role="tabpanel" style="">
    <div class="panel-heading">修改预约信息</div>
       <div class="panel-body" >	

			<div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label"><b>原来的预约信息</b></label>
				<div class="col-sm-9 col-xs-12">
                    <table class='table'>
						{if $op=='display'}
						<tr><td>用户uid：<input type="text" name="uid" value=""  size="4"/></td></tr>
						{else}
						<tr style="display: none;"><td>用户：<input type="hidden" name="uid" value="-1"  size="4"/></td></tr>
						<tr><td>用户姓名：<input type="text" name="offline_username" value=""   style="width: 140px;"/></td></tr>
						<tr><td>用户电话：<input type="number" name="offline_mobile" value=""   style="width: 140px;"/></td></tr>
						{/if}

						<tr><td>店铺活动id：<input type="text" name="storeid" value="{$themeid}" readonly="readonly" size="4"/></td></tr>
						<tr><td>预约的分支店铺：<select name="shopid" id="mySelect">
								{loop $shopconfig $k $item}
									<option value="{$item['shopid']}">{$item['name']}</option>
								{/loop}
							</select></td>
                        </tr>
                    </table>
				</div>
			</div>
			<div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label"><b>选择预约时间</b></label>
				<div class="col-sm-9 col-xs-12">
					<span class="help-block"><a style="background-color:#428bca;padding: 5px 10px; color: white;border-radius:5px;" onclick ="loadBaseInfo()">选择预约时间</a></span>
					  <div id="yx_calendar"></div>
				</div>
			</div>			
			
			<div class="form-group">
				<div class="col-sm-12">
					<input name="submit" id="btn_submit" type="submit" value="提交" class="btn btn-primary col-lg-1">
					<input type="hidden" name="__token__" value="{$Request.token}" />
				</div>
			</div>
		
		</div>
	</div>
</div>

</form>	
{/if} 
<script>
	//日历页请求
	function loadBaseInfo() {
		var postUrl = "{php echo createWebUrlPlugin('shopplan.calendar',array('themeid'=>$themeid,'uid'=>$userplaned['uid']));}";
		var shopid =$("#mySelect").val();
			postUrl+='&shopid='+shopid;				
        $.ajax({
          type:'POST',
          dataType:'json',
          url:postUrl,
          success:function (res){
            var data = res.data;
            var ruleBtn = data.ruleBtn_html;
            $("#yx_calendar").empty();
            $("#yx_calendar").append(ruleBtn);
          }
        });		
	}
    //下一个月
    function changeNextDate(nextyear,nextmonth){
		var postUrl = "{php echo createWebUrlPlugin('shopplan.calendar',array('themeid'=>$themeid,'uid'=>$userplaned['uid']));}";
		var shopid =$("#mySelect").val();
			postUrl+='&shopid='+shopid;				
      		postUrl+='&y_now='+nextyear;
      		postUrl+='&m_n='+nextmonth;
	    $.ajax({
          type:'POST',
          dataType:'json',
          url:postUrl,
          success:function (res){
            var data = res.data;
            var ruleBtn = data.ruleBtn_html;
            $("#yx_calendar").empty();
            $("#yx_calendar").append(ruleBtn);
          }
        });	
    }
    //前一个月
    function changePreDate(prevyear,prevmonth){
		var postUrl = "{php echo createWebUrlPlugin('shopplan.calendar',array('themeid'=>$themeid,'uid'=>$userplaned['uid']));}";
		var shopid =$("#mySelect").val();
			postUrl+='&shopid='+shopid;				
      		postUrl+='&y_now='+prevyear;
      		postUrl+='&m_n='+prevmonth;
	    $.ajax({
	      type:'POST',
	      dataType:'json',
	      url:postUrl,
	      success:function (res){
	        var data = res.data;
	        var ruleBtn = data.ruleBtn_html;
	        $("#yx_calendar").empty();
	        $("#yx_calendar").append(ruleBtn);
	      }
	    });
    }
    //客户预约填写
    function userPlan(date,totalnums,planed,tplid){
		var postUrl = "{php echo createWebUrlPlugin('shopplan.userplan',array('themeid'=>$themeid,'uid'=>$userplaned['uid']));}";
		var shopid =$("#mySelect").val();
			postUrl+='&shopid='+shopid;		
      		postUrl+='&date='+date;
      		postUrl+='&totalnums='+totalnums;
      		postUrl+='&planed='+planed;
      		postUrl+='&tplid='+tplid;
	    $.ajax({
	      type:'POST',
	      dataType:'json',
	      url:postUrl,
	      success:function (res){
	        var data = res.data;
	        var ruleBtn = data.ruleBtn_html;
	        $("#yx_calendar").empty();
	        $("#yx_calendar").append(ruleBtn);
	      }
	    });
    }
	//分店选择事件
    $("#mySelect").change(function(){  
		//添加所需要执行的操作代码
		var postUrl = "{php echo createWebUrlPlugin('shopplan.calendar',array('themeid'=>$themeid,'uid'=>$userplaned['uid']));}";
		var shopid =$("#mySelect").val();
		postUrl+='&shopid='+shopid;
        $.ajax({
          type:'POST',
          dataType:'json',
          url:postUrl,
          success:function (res){
            var data = res.data;
            var ruleBtn = data.ruleBtn_html;
            $("#yx_calendar").empty();
            $("#yx_calendar").append(ruleBtn);
          }
        });			  
    })    
</script>

